<?php
declare (strict_types = 1);

namespace app\api\controller;

class Auth extends Base {

    protected $user = [];

    protected $token = "";

    public function initialize()
    {
        parent::initialize();

        $token = $this->request->header("access-token", "");
        $this->token = $token;

        if ($token == "") {
            return false;
        }

        if (!cache("?". config("redis.token_pre") . $token)) {
            return false;
        }

        $this->user = cache(config("redis.token_pre") . $token);
    }
}